home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_064 / include / iff / 8svx.h next >
C/C++ Source or Header  |  1992-05-06  |  4KB  |  97 lines

  1. /*----------------------------------------------------------------------*
  2.  * 8SVX.H  Definitions for 8-bit sampled voice (VOX).   2/10/86
  3.  *
  4.  * By Jerry Morrison and Steve Hayes, Electronic Arts.
  5.  * This software is in the public domain.
  6.  *
  7.  * This version for the Commodore-Amiga computer.
  8.  *----------------------------------------------------------------------*/
  9. #ifndef EIGHTSVX_H
  10. #define EIGHTSVX_H
  11.  
  12. #ifndef COMPILER_H
  13. #include "iff/compiler.h"
  14. #endif
  15.  
  16. #include "iff/iff.h"
  17.  
  18. #define ID_8SVX      MakeID('8', 'S', 'V', 'X')
  19. #define ID_VHDR      MakeID('V', 'H', 'D', 'R')
  20. #define ID_NAME      MakeID('N', 'A', 'M', 'E')
  21. #define ID_Copyright MakeID('(', 'c', ')', ' ')
  22.  
  23. #define ID_AUTH      MakeID('A', 'U', 'T', 'H')
  24. #define ID_ANNO      MakeID('A', 'N', 'N', 'O')
  25.  
  26. #define ID_BODY      MakeID('B', 'O', 'D', 'Y')
  27.  
  28. #define ID_ATAK      MakeID('A', 'T', 'A', 'K')
  29. #define ID_RLSE      MakeID('R', 'L', 'S', 'E')
  30.  
  31. /* ---------- Voice8Header ---------------------------------------------*/
  32. typedef LONG Fixed;    /* A fixed-point value, 16 bits to the left of
  33.              * the point and 16 to the right. A Fixed is a
  34.              * number of 2**16ths, i.e. 65536ths. */
  35. #define Unity 0x10000L    /* Unity = Fixed 1.0 = maximum volume */
  36.  
  37. /* sCompression: Choice of compression algorithm applied to the samples. */
  38. #define sCmpNone       0    /* not compressed */
  39. #define sCmpFibDelta   1    /* Fibonacci-delta encoding (Appendix C) */
  40.                 /* Could be more kinds in the future. */
  41. typedef struct {
  42.     ULONG oneShotHiSamples,    /* # samples in the high octave 1-shot part */
  43.           repeatHiSamples,    /* # samples in the high octave repeat part */
  44.           samplesPerHiCycle;    /* # samples/cycle in high octave, else 0 */
  45.     UWORD samplesPerSec;    /* data sampling rate */
  46.     UBYTE ctOctave,        /* # of octaves of waveforms */
  47.           sCompression;        /* data compression technique used */
  48.     Fixed volume;        /* playback nominal volume from 0 to Unity
  49.                  * (full volume). Map this value into
  50.                  * the output hardware's dynamic range.
  51.                  */
  52.     } Voice8Header;
  53.  
  54. /* ---------- NAME -----------------------------------------------------*/
  55. /* NAME chunk contains a CHAR[], the voice's name. */
  56.  
  57. /* ---------- Copyright ------------------------------------------------*/
  58. /* "(c) " chunk contains a CHAR[], the FORM's copyright notice. */
  59.  
  60. /* ---------- AUTH -----------------------------------------------------*/
  61. /* AUTH chunk contains a CHAR[], the author's name. */
  62.  
  63. /* ---------- ANNO -----------------------------------------------------*/
  64. /* ANNO chunk contains a CHAR[], the author's text annotations. */
  65.  
  66. /* ---------- Envelope ATAK & RLSE -------------------------------------*/
  67. typedef struct {
  68.     UWORD duration;    /* segment duration in milliseconds, > 0 */
  69.     Fixed dest;        /* destination volume factor */
  70.     } EGPoint;
  71.  
  72. /* ATAK and RLSE chunks contain an EGPoint[], piecewise-linear envelope. */
  73.  
  74. /* The envelope defines a function of time returning Fixed values.
  75.  * It's used to scale the nominal volume specified in the Voice8Header.
  76.  */
  77.  
  78. /* ---------- BODY -----------------------------------------------------*/
  79. /* BODY chunk contains a BYTE[], array of audio data samples. */
  80. /* (8-bit signed numbers, -128 through 127.) */
  81.  
  82.  
  83. /* ---------- 8SVX Reader Support Routines -----------------------------*/
  84.  
  85. /* Just call this macro to read a VHDR chunk. */
  86. #define GetVHDR(context, vHdr)  \
  87.     IFFReadBytes(context, (BYTE *)vHdr, sizeof(Voice8Header))
  88.  
  89.  
  90. /* ---------- 8SVX Writer Support Routines -----------------------------*/
  91.  
  92. /* Just call this macro to write a VHDR chunk. */
  93. #define PutVHDR(context, vHdr)  \
  94.     PutCk(context, ID_VHDR, sizeof(Voice8Header), (BYTE *)vHdr)
  95.  
  96. #endif
  97.